Both solutions are equivalent to the official ones.

Q1 Solution

Debarshi Deka (2017A8PS0494G)


In [ ]:
n=input()
a=n.split(",")
b=[(sum(int(i[k]) for k in range(len(i)))) for i in a]
d=dict(zip(a,b))
for i in d:
    print(i,"~",d[i])

Q2 Solution

Ishan Sang (2017A7PS0069G)


In [ ]:
N=(int)(input())
 
sequence=[[i+int((N*j)-((j*(j+1))/2))
          for j in range(0,i)]
          for i in range(1,N+1)]
 
for i in sequence:
    for j in i:
        print(j,end=" ")
    print()